Skip to content

fix(infra): keep manual side window resizes - #617

Open
luismbo wants to merge 1 commit into
tninja:mainfrom
luismbo:fix/side-window-manual-resize
Open

luismbo wants to merge 1 commit into
tninja:mainfrom
luismbo:fix/side-window-manual-resize

Conversation

@luismbo

@luismbo luismbo commented Nov 27, 2026

Copy link
Copy Markdown

Problem

The AI session side panel can't be resized manually. Dragging its divider, or using C-x { / C-x } / enlarge-window, works briefly, but about 0.1 s later the panel snaps back to ai-code-backends-infra-window-width / -height.

The cause is the deferred restore added in fbde6a9. It hooks window-size-change-functions, which runs after every size change, including the user's own. Each change schedules ai-code-backends-infra--restore-side-window-sizes, which refits the panel to the configured size. Only the C-. / C-, grow/shrink commands could change the size, because they update the target variable itself.

Fix

  • Every time the package sizes a managed panel, it records the frame size and the panel's total size as a window parameter.
  • When the deferred restore runs, a change in the panel's total size while the frame size stayed the same is treated as a manual resize. The panel's current body width (left/right) or total height (top/bottom) becomes the new target, the same way C-. / C-, update it.
  • Frame resizes are still treated as layout drift and repaired, so the space-recovery behavior from fbde6a9 is kept.
  • The comparison uses total size, not body size, so margin-only changes are still repaired back to the configured body width.

Tests

  • New tests in test/test_ai-code-backends-infra-window.el:
    • a manual grow and shrink is adopted on all four sides and survives later frame resizes;
    • the deferred restore triggered by a manual resize doesn't undo it;
    • a margin change is still repaired.
  • deferred-restore-coalesces used to simulate layout drift with window-resize, which now counts as a manual resize. It changes the target width instead.
  • display-buffer-in-side-window-uses-body-width passes a fake window symbol, so it now stubs the new recording function.
  • The full test suite has the same failures before and after this change; they are unrelated to it (ghostel, gptel-agent, goose, editor-viewport). Byte-compile and checkdoc are clean on the touched files.
  • README: added a note next to the C-. / C-, docs.

The deferred restore added in fbde6a9 ran after every window size
change, including the user's own, and snapped the panel back to the
configured width/height about 0.1s later, so the panel could not be
resized by dragging its divider or with enlarge/shrink-window.

Record the frame size and the panel's total size whenever the panel
is sized.  When the restore runs and the panel's total size changed
while the frame size did not, adopt the new size as the target
instead of undoing it.  Frame resizes and margin-only changes are
still repaired as before.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@tninja

tninja commented Nov 27, 2026 via email

Copy link
Copy Markdown
Owner

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants